<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			// 获取当前时间
			var now = new Date();
			// 定义星期几的列表
			var weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
			// 格式化日期时间
			var year = now.getFullYear();
			var month = String(now.getMonth() + 1).padStart(2, '0');
			var date = String(now.getDate()).padStart(2, '0');
			var hours = String(now.getHours()).padStart(2, '0');
			var minutes = String(now.getMinutes()).padStart(2, '0');
			var seconds = String(now.getSeconds()).padStart(2, '0');
			var weekDay = weekDays[now.getDay()];
			
			// 构造显示字符串
			var displayString = `${weekDay}, ${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
			
			// 输出显示字符串
			alert(displayString);
		</script>
	</head>
	<body>
		<p>
			4： 实现时间的显示功能，(Date)
			要求能显示星期几，年月日，小时分钟秒
		</p>
	</body>
</html>
